<template>

  <van-swipe-cell>
    <div @click="handleGo(item.id)" v-for="item in list">
      <van-card :desc="item.description" :title="item.name" :price="item.sex == 1 ? '男' : '女'" class="goods-card"
        :thumb="item.photo" />
    </div>
    <template #right>
      <van-button square text="删除" type="danger" class="delete-button" />
    </template>
  </van-swipe-cell>
  <div class="fixed-widgets">
    <span class="ant-avatar ant-avatar-circle ant-avatar-icon ant-dropdown-trigger fixed-widgets-avatar"
      style="width: 54px; height: 54px; line-height: 44px; font-size: 24px;">
      <span role="img" class="anticon">
        举报
      </span></span>
  </div>

</template>

<script>
import { SwipeCell } from 'vant';
import { ref, createApp, onMounted } from 'vue';
import axios from 'axios'
import Cookie from 'js-cookie'
import { useRouter, useRoute } from 'vue-router'

export default {
  setup() {
    const item = ref(null);
    const value = ref(0);
    const list = ref([])
    const router = useRouter()
    const onClickLeft = () => history.back()

    const handleGo = (id) => {
      router.push({ name: 'detail', query: { id, type: 'clue' } })
    }
    onMounted(() => {
      axios.get('/mock/clues').then(res => {
        if (res.data.code == 200) {
          list.value = res.data.data
          list.value = [...list.value, JSON.parse(Cookie.get('clueList'))]
        }
      })
    })
    return {
      handleGo,
      item,
      value,
      list,
      onClickLeft
    };
  },
};


// const app = createApp();
// app.use(SwipeCell);


</script>

<style>
.goods-card {
  margin: 0;
  background-color: @white;
}

.delete-button {
  height: 100%;
}

.fixed-widgets {
  position: fixed;
  right: 32px;
  bottom: 102px;
  z-index: 2147483640;
  display: flex;
  flex-direction: column;
  cursor: pointer;
}

.fixed-widgets .fixed-widgets-avatar {
  color: #fff;
  background-color: blue;
  box-shadow: 0 3px 6px -4px #0000001f, 0 6px 16px #00000014, 0 9px 28px 8px #0000000d;
  transition: color .3s;
}

.anticon {
  display: inline-block;
  color: inherit;
  font-style: normal;
  text-align: center;
  text-transform: none;
  text-rendering: optimizelegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 12px;
}

.ant-avatar {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  color: #000000d9;
  font-size: 14px;
  font-variant: tabular-nums;
  line-height: 1.5715;
  list-style: none;
  font-feature-settings: "tnum";
  position: relative;
  display: inline-block;
  overflow: hidden;
  color: #fff;
  white-space: nowrap;
  text-align: center;
  vertical-align: middle;
  background: #ccc;
  width: 102px;
  height: 102px;
  line-height: 82px;
  border-radius: 50%;
}
</style>

